package com.baizhi.controller;

import com.baizhi.entity.Category;
import com.baizhi.entity.ResultMap;
import com.baizhi.service.CategoryService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("category")
public class CategoryController {
    @Autowired
    private CategoryService categoryService;
    @RequestMapping("select")
    public ResultMap select(Integer page,Integer limit){
        PageInfo<Category> pageInfo = categoryService.selectByPage(page, limit);
        ResultMap map = new ResultMap();
        map.setCount(pageInfo.getTotal());
        map.setData(pageInfo.getList());
        return map;
    }
}
